Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
bcp-47-normalize
Advanced tools
Normalize, canonicalize, and format BCP 47 tags.
npm:
npm install bcp-47-normalize
var normalize = require('bcp-47-normalize')
var tags = [
'de-de-1901',
'en-gb',
'en-us',
'en-bu',
'hy-arevmda',
'nld-nl',
'no-nyn',
'pt-br',
'pt-pt',
'zh-hans-cn'
]
tags.forEach(function(tag) {
console.log('%s -> %s', tag, normalize(tag))
})
Yields:
de-de-1901 -> de-1901
en-gb -> en-GB
en-us -> en
en-bu -> en-MM
hy-arevmda -> hyw
nld-nl -> nl
no-nyn -> nn
pt-br -> pt
pt-pt -> pt-PT
zh-hans-cn -> zh-CN
normalize(tag[, options])
Normalize the given BCP 47 tag according to Unicode CLDR suggestions.
options.forgiving
Passed to bcp-47
as options.forgiving
.
options.warning
Passed to bcp-47
as options.warning
.
One additional warning is given:
code | reason |
---|---|
7 | Deprecated region CURRENT , expected one of SUGGESTIONS |
This warning is only given if the region cannot be automatically fixed (when regions split into multiple regions).
string
— Normal, canonical, and pretty BCP 47 tag.
bcp-47
— Parse and stringify BCP 47 language tagsbcp-47-match
— Match BCP 47 language tags with language ranges per RFC 4647iso-3166
— ISO 3166 codesiso-639-2
— ISO 639-2 codesiso-639-3
— ISO 639-3 codesiso-15924
— ISO 15924 codesun-m49
— UN M49 codesFAQs
Normalize, canonicalize, and format BCP 47 tags
The npm package bcp-47-normalize receives a total of 101,739 weekly downloads. As such, bcp-47-normalize popularity was classified as popular.
We found that bcp-47-normalize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.